//package com.Jshop.order.listener;
//
//
//import com.Jshop.order.pojo.Order;
//import com.Jshop.order.service.OrderService;
//import org.springframework.amqp.rabbit.annotation.Queue;
//import org.springframework.amqp.rabbit.annotation.QueueBinding;
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.util.Map;
//
//
///**
// * @Description 下单后订单消息发送至该队列 此处逻辑会监听该消息并进行消费
// * @Param
// * @return
// * @Date  2021/11/11
// **/
//@Component
//@RabbitListener(queues = "orderListenQueue")
//public class DelayMessageQueueListener {
//
//    @Autowired
//    private OrderService orderService;
//
////    @Autowired
////    private WeChatPayFeign weChatPayFeign;
//
//
//    @RabbitHandler
//    public void getMessage(String orderId) throws Exception {
//        System.out.println("延时队列收到消息：" + orderId + "1");
//        System.out.println("延时队列收到消息：" + orderId + "1");
//        System.out.println("延时队列收到消息：" + orderId + "1");
////        Order order = orderService.findById(orderId);
////        if ("0".equals(order.getPayStatus())) {
////            //0表示未支付，通知微信服务器取消订单，从数据库中删除订单，回滚库存
////            Map<String, String> closeResult = weChatPayFeign.closeOrder(orderId).getData();
////            //如果错误代码为ORDERPAID则说明订单已经支付，当作正常订单处理,反之 回滚库存
////            if (!("FAIL".equals(closeResult.get("result_code")) && "ORDERPAID".equals(closeResult.get("err_code")))) {
////                orderService.deleteOrder(orderId);
////            }
////        }
//    }
//
//}
